Triple State QuickSort, A replacement for the C/C++ library qsort
نویسنده
چکیده
An industrial grade Quicksort function along with its new algorithm is presented. Compared to 4 other well known implementations of Quicksort, the new algorithm reduces both the number of comparisons and swaps in most cases while staying close to the best of the 4 in worst cases. We trade space for performance, at the price of n/2 temporary extra spaces in the worst case. Run time tests reveal an overall improvement of at least 15.8% compared to the overall best of the other 4 functions. Furthermore, our function scores a 32.7% run time improvement against Yaroslavskiy’s new Dual Pivot Quicksort. Our function is pointer based, which is meant as a replacement for the C/C++ library qsort(). But we also provide an array based function of the same algorithm for easy porting to different programming languages. Keywords—quicksort; sorting; pivot; dual pivot; swaps
منابع مشابه
A Killer Adversary for Quicksort
Quicksort can be made to go quadratic by constructing input on the fly in response to the sequence of items compared. The technique is illustrated by a specific adversary for the standard C qsort function. The general method works against any implementation of quicksort–even a randomizing one–that satisfies certain very mild and realistic assumptions. When using quicksort one often feels a nagg...
متن کاملSort Race
Sorting is one of the oldest computing problems and is still very important in the age of big data. Various algorithms and implementation techniques have been proposed. In this study, we focus on comparison based, internal sorting algorithms. We created 12 data types of various sizes for experiments and tested extensively various implementations in a single setting. Using some effective techniq...
متن کاملIncreasing the Efficiency of Existing Sorting Algorithms by Using Randomized Wrappers
There are several generic sorting algorithms available that are highly optimized and are provided as part of standard programming libraries, such as the qsort implementation of quicksort available through the C standard library. In this work we present a practical algorithmic transformation that uses random sampling and ordered search, that can convert an existing implementation of any sorting ...
متن کاملPerformance Evaluation of Parallel Programs
In this assignment you will examine the performance of a parallel sorting algorithm. Let’s start with the sequential case. The program that you are going to investigate is based on the Quicksort algorithm. For a given size, a vector is created and filled with random numbers. Then qsort() from the standard C library is called to sort the array. In the parallel case, we also create an array of a ...
متن کاملNeatSort - A practical adaptive algorithm
We present a new adaptive sorting algorithm which is optimal for most disorder metrics and, more important, has a simple and quick implementation. On input X, our algorithm has a theoretical Ω(|X|) lower bound and a O(|X| log |X|) upper bound, exhibiting amazing adaptive properties which makes it run closer to its lower bound as disorder (computed on different metrics) diminishes. From a practi...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- CoRR
دوره abs/1505.00558 شماره
صفحات -
تاریخ انتشار 2015